home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / advanc2a / select.frm (.txt) next >
Visual Basic Form  |  1997-11-19  |  3KB  |  104 lines

  1. VERSION 5.00
  2. Begin VB.Form frmSelect 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Video Source"
  5.    ClientHeight    =   1080
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   4155
  9.    ControlBox      =   0   'False
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   1080
  14.    ScaleWidth      =   4155
  15.    StartUpPosition =   1  'CenterOwner
  16.    Begin VB.CommandButton cmdCancel 
  17.       Caption         =   "Cancel"
  18.       Height          =   300
  19.       Left            =   3120
  20.       TabIndex        =   2
  21.       Top             =   720
  22.       Width           =   900
  23.    End
  24.    Begin VB.CommandButton cmdSelect 
  25.       Caption         =   "Select"
  26.       Default         =   -1  'True
  27.       Height          =   300
  28.       Left            =   2160
  29.       TabIndex        =   1
  30.       Top             =   720
  31.       Width           =   900
  32.    End
  33.    Begin VB.ComboBox cmboSource 
  34.       Height          =   315
  35.       Left            =   120
  36.       Style           =   2  'Dropdown List
  37.       TabIndex        =   0
  38.       Top             =   360
  39.       Width           =   3975
  40.    End
  41.    Begin VB.Label lblDriver 
  42.       Caption         =   "Installed Drivers:"
  43.       Height          =   255
  44.       Left            =   120
  45.       TabIndex        =   3
  46.       Top             =   120
  47.       Width           =   4095
  48.    End
  49. Attribute VB_Name = "frmSelect"
  50. Attribute VB_GlobalNameSpace = False
  51. Attribute VB_Creatable = False
  52. Attribute VB_PredeclaredId = True
  53. Attribute VB_Exposed = False
  54. Option Explicit
  55. Private Sub Command1_Click()
  56. End Sub
  57. Private Sub cmdCancel_Click()
  58.     Unload Me
  59. End Sub
  60. Private Sub cmdSelect_Click()
  61.     Dim sTitle As String
  62.     Dim Caps As CAPDRIVERCAPS
  63.     If cmboSource.ListIndex <> -1 Then
  64.         
  65.         '// Connect the capture window to the driver
  66.         If capDriverConnect(lwndC, cmboSource.ListIndex) Then
  67.             '// Get the capabilities of the capture driver
  68.             capDriverGetCaps lwndC, VarPtr(Caps), Len(Caps)
  69.             
  70.             '// If the capture driver does not support a dialog, grey it out
  71.             '// in the menu bar.
  72.             frmMain.mnuSource.Enabled = Caps.fHasDlgVideoSource
  73.             frmMain.mnuFormat.Enabled = Caps.fHasDlgVideoFormat
  74.             frmMain.mnuDisplay.Enabled = Caps.fHasDlgVideoDisplay
  75.         
  76.             sTitle = cmboSource.Text
  77.             
  78.             SetWindowText lwndC, sTitle
  79.             ResizeCaptureWindow lwndC
  80.         End If
  81.     End If
  82.     Unload Me
  83. End Sub
  84. Private Sub Form_Load()
  85.     Dim lpszName As String * 100
  86.     Dim lpszVer As String * 100
  87.     Dim x As Integer
  88.     Dim lResult As Long
  89.     Dim Caps As CAPDRIVERCAPS
  90.     '// Get a list of all the installed drivers
  91.     x = 0
  92.     Do
  93.         lResult = capGetDriverDescriptionA(x, lpszName, 100, lpszVer, 100)   '// Retrieves driver info
  94.         If lResult Then
  95.             cmboSource.AddItem lpszName
  96.             x = x + 1
  97.         End If
  98.     Loop Until lResult = False
  99.     '// Get the capabilities of the current capture driver
  100.     lResult = capDriverGetCaps(lwndC, VarPtr(Caps), Len(Caps))
  101.     '// Select the driver that is currently being used
  102.     If lResult Then cmboSource.ListIndex = Caps.wDeviceIndex
  103. End Sub
  104.